import App from './App'
import Vue from 'vue'
// 创建一个过滤器，将时间戳转化为标准时间
Vue.filter('dateFormat', function(originVal) {
	if (originVal) {
		const dt = new Date(originVal * 1000)
		const y = dt.getFullYear()
		const m = (dt.getMonth() + 1 + '').padStart(2, '0')
		const d = (dt.getDate() + '').padStart(2, '0')
		return `${y}-${m}-${d}`
	}
})
import store from './store' // store
Vue.prototype.$store = store
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
import mixin from './mixins';
Vue.mixin(mixin);
import api from '@/network/api.js';
Vue.prototype.$rqt = api;
import myPopup from '@/components/popup.vue'
Vue.component('myPopup', myPopup)
import myFixedBtn from '@/components/fixedBtn.vue'
Vue.component('myFixedBtn', myFixedBtn)
import myTags from '@/components/tags.vue'
Vue.component('myTags', myTags)
import myEmpty from '@/components/empty.vue'
Vue.component('myEmpty', myEmpty)
import myNumberBox from '@/components/numberBox.vue'
Vue.component('myNumberBox', myNumberBox)
import myPicker from '@/components/picker.vue'
Vue.component('myPicker', myPicker)
import Tabbar from '@/components/tabbar.vue'
Vue.component('Tabbar', Tabbar)
import supermarket from '@/components/supermarket.vue'
Vue.component('supermarket', supermarket)
import bottom from '@/components/bottom.vue'
Vue.component('bottom', bottom)
// #ifndef VUE3
import './uni.promisify.adaptor'
Vue.config.productionTip = false
Date.prototype.format = function(fmt) {
	var o = {
		"M+": this.getMonth() + 1, //月份 
		"d+": this.getDate(), //日 
		"h+": this.getHours(), //小时 
		"m+": this.getMinutes(), //分 
		"s+": this.getSeconds(), //秒 
		"q+": Math.floor((this.getMonth() + 3) / 3), //季度 
		"S": this.getMilliseconds() //毫秒 
	};
	if (/(y+)/.test(fmt)) {
		fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
	}
	for (var k in o) {
		if (new RegExp("(" + k + ")").test(fmt)) {
			fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k])
				.length)));
		}
	}
	return fmt;
}
App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif